//  BuyerReaderViewController.m
//  project
//
//  Created by 张亚林 on 2017/10/26.
//  Copyright © 2017年 Macmini. All rights reserved.
//

#import "BuyerReaderViewController.h"
#import "VCHConversationViewController.h"
#import "ChatTestViewController.h"
#import <BQMM/BQMM.h>
//#import "FastReplyVC.h"
#import "CHAvatarBrowser.h"
#import "KGConversationListVC.h"
@interface BuyerReaderViewController ()
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *yaoqiuConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *leftConstraint;
@property (weak, nonatomic) IBOutlet UIButton *woyifukuanBtn;
@property (weak, nonatomic) IBOutlet UIButton *yaoqiukefuBtn;
@property (weak, nonatomic) IBOutlet UIView *chatView;
@property (weak, nonatomic) IBOutlet UIView *headerView;
@end

@implementation BuyerReaderViewController



- (void)viewDidLoad {
    [super viewDidLoad];
//    VCHConversationViewController* chatVC =  [VCHConversationViewController new];
//    //            VCHConversationViewController *ctrl = segue.destinationViewController;
//    chatVC.conversationType = ConversationType_PRIVATE;
//    chatVC.targetId = @"vhuichen@126.com";
//    chatVC.title = @"会话";
//    chatVC.hidesBottomBarWhenPushed = YES;
//    [MMEmotionCentre defaultCentre].delegate = _inputToolBar; //set SDK delegate
//    //    [[MMEmotionCentre defaultCentre] shouldShowShotcutPopoverAboveView:_inputToolBar.emojiButton withInput:_inputToolBar.inputTextView];
  
       [self configureConstraint:1];
    [self.view layoutIfNeeded];
//    [self chatKeFu];
//    self.yaoqiuConstraint.priority = 1000;
//    self.leftConstraint.priority = 750;
 

    // Do any additional setup after loading the view from its nib.
}

- (IBAction)kefuJieRuAction:(id)sender {
    [self chatKeFu];
}

- (void)viewWillLayoutSubviews {
  
    
    [super viewWillLayoutSubviews];
}
- (void)chatKeFu
{
    VCHConversationViewController* chatVC =  [VCHConversationViewController new];
    //            VCHConversationViewController *ctrl = segue.destinationViewController;
   
    chatVC.title = @"会话";
    chatVC.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:chatVC animated:YES];
 
//    [self.navigationController pushViewController:chatVC animated:YES];
 
//    [[RCIM sharedRCIM] connectWithToken:@"zTqG4tuECwwNZNzQAg6vDSb5NDtUcwko6Dg8ItLlzZF9p/sxAmbqAj1FeCQ1LsDp1gOFHHIWkA/xCWT+QLCgKQ==" success:^(NSString *userId) {
//
//        dispatch_async(dispatch_get_main_queue(), ^{
//            //
////            KGConversationListVC *vc = [[KGConversationListVC alloc] init];
////            UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
////
////            UIWindow *window = [UIApplication sharedApplication].keyWindow;
////            window.rootViewController = nav;
//            //
//
//
//        });
    
    
    
//    } error:^(RCConnectErrorCode status) {
//
//
//    } tokenIncorrect:^{
//
//        NSLog(@"[Error] tokenincorrect");
//
//    }];
}
-(void)configureConstraint:(NSInteger)type {
    
    if (type == 1) {
        self.yaoqiuConstraint.priority = 1000;
        self.leftConstraint.priority = 750;
        self.woyifukuanBtn.hidden = YES;
    } else {
         self.woyifukuanBtn.hidden = NO;
        self.yaoqiuConstraint.priority = 750;
        self.leftConstraint.priority = 1000;
        
    }
    
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
